package cn.com.zpark.servlet_request;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: cn.com.zpark.servlet_request
 * @ClassName: RequestDemo03
 * @Description:
 * @author: RZS
 * @date: 2021/11/14  15:47
 */
@WebServlet("/rd3.do")
public class RequestDemo03 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 修改请求缓冲区字符编码
        request.setCharacterEncoding("utf-8");

        // 获取请求参数
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        System.out.println(username+": "+password);

        response.getWriter().write("<h1>"+username+": "+password+"</h1>");
    }
}
